package com.zzsy.carosshopprojects.util;

import android.app.Activity;
import android.content.Intent;

import com.sunmi.appstorelib.SunmiAppStoreUtil;
import com.zzsy.carosshopprojects.activitys.login.LoginAc;
import com.zzsy.carosshopprojects.view.dialog.ComOneBtnDialog;

/**
 * Created by Administrator on 2020/4/2 0002.
 */

public class ShowDialogUtils {

    //private static ComOneBtnDialog comOneBtnDialog;

    /**
     * 设置强制更新对话窗
     * */
    public static void showDialogs(Activity activity,  int type,int dataType) {
//        if (comOneBtnDialog != null) {
//            comOneBtnDialog.dismiss();
//        }
        ComOneBtnDialog comOneBtnDialog = new ComOneBtnDialog(activity, type, null);
        comOneBtnDialog.show();
        comOneBtnDialog.setDialogBtnClickListener(new ComOneBtnDialog.IDialogBtnClickListener() {
            @Override
            public void onDialogBtnClick() {
                comOneBtnDialog.dismiss();
                if(dataType == 1){
                    activity.startActivity(new Intent(activity, LoginAc.class));
                    activity.overridePendingTransition(0, 0);
                    activity.finish();
                }else if(dataType == 2){
//                    ActivityCollector.finishActivty(MemberRechargeActivity.class);
//                    ActivityCollector.finishActivty(RechargePayTwoActivity.class);
                }else if(dataType == 3){
                    activity.finish();
                }
            }

            @Override
            public void onDialogGoMarkerBtnClick() {
                SunmiAppStoreUtil.startAppDetail(activity.getApplicationContext(), "com.zzsy.carosshopprojects");
            }
        });
    }
}
